/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Protection.impl;

import EA_Model.IEC61970.Domain.AngleRadians;
import EA_Model.IEC61970.Domain.Frequency;
import EA_Model.IEC61970.Domain.Voltage;

import EA_Model.IEC61970.Protection.ProtectionPackage;
import EA_Model.IEC61970.Protection.SynchrocheckRelay;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Synchrocheck Relay</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.SynchrocheckRelayImpl#getMaxAngleDiff <em>Max Angle Diff</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.SynchrocheckRelayImpl#getMaxFreqDiff <em>Max Freq Diff</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.SynchrocheckRelayImpl#getMaxVoltDiff <em>Max Volt Diff</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SynchrocheckRelayImpl extends ProtectionEquipmentImpl implements SynchrocheckRelay {
	/**
	 * The cached value of the '{@link #getMaxAngleDiff() <em>Max Angle Diff</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxAngleDiff()
	 * @generated
	 * @ordered
	 */
	protected AngleRadians maxAngleDiff;

	/**
	 * The cached value of the '{@link #getMaxFreqDiff() <em>Max Freq Diff</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxFreqDiff()
	 * @generated
	 * @ordered
	 */
	protected Frequency maxFreqDiff;

	/**
	 * The cached value of the '{@link #getMaxVoltDiff() <em>Max Volt Diff</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxVoltDiff()
	 * @generated
	 * @ordered
	 */
	protected Voltage maxVoltDiff;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SynchrocheckRelayImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProtectionPackage.Literals.SYNCHROCHECK_RELAY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AngleRadians getMaxAngleDiff() {
		if (maxAngleDiff != null && maxAngleDiff.eIsProxy()) {
			InternalEObject oldMaxAngleDiff = (InternalEObject)maxAngleDiff;
			maxAngleDiff = (AngleRadians)eResolveProxy(oldMaxAngleDiff);
			if (maxAngleDiff != oldMaxAngleDiff) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.SYNCHROCHECK_RELAY__MAX_ANGLE_DIFF, oldMaxAngleDiff, maxAngleDiff));
			}
		}
		return maxAngleDiff;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AngleRadians basicGetMaxAngleDiff() {
		return maxAngleDiff;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMaxAngleDiff(AngleRadians newMaxAngleDiff) {
		AngleRadians oldMaxAngleDiff = maxAngleDiff;
		maxAngleDiff = newMaxAngleDiff;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.SYNCHROCHECK_RELAY__MAX_ANGLE_DIFF, oldMaxAngleDiff, maxAngleDiff));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Frequency getMaxFreqDiff() {
		if (maxFreqDiff != null && maxFreqDiff.eIsProxy()) {
			InternalEObject oldMaxFreqDiff = (InternalEObject)maxFreqDiff;
			maxFreqDiff = (Frequency)eResolveProxy(oldMaxFreqDiff);
			if (maxFreqDiff != oldMaxFreqDiff) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.SYNCHROCHECK_RELAY__MAX_FREQ_DIFF, oldMaxFreqDiff, maxFreqDiff));
			}
		}
		return maxFreqDiff;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Frequency basicGetMaxFreqDiff() {
		return maxFreqDiff;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMaxFreqDiff(Frequency newMaxFreqDiff) {
		Frequency oldMaxFreqDiff = maxFreqDiff;
		maxFreqDiff = newMaxFreqDiff;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.SYNCHROCHECK_RELAY__MAX_FREQ_DIFF, oldMaxFreqDiff, maxFreqDiff));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage getMaxVoltDiff() {
		if (maxVoltDiff != null && maxVoltDiff.eIsProxy()) {
			InternalEObject oldMaxVoltDiff = (InternalEObject)maxVoltDiff;
			maxVoltDiff = (Voltage)eResolveProxy(oldMaxVoltDiff);
			if (maxVoltDiff != oldMaxVoltDiff) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.SYNCHROCHECK_RELAY__MAX_VOLT_DIFF, oldMaxVoltDiff, maxVoltDiff));
			}
		}
		return maxVoltDiff;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage basicGetMaxVoltDiff() {
		return maxVoltDiff;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMaxVoltDiff(Voltage newMaxVoltDiff) {
		Voltage oldMaxVoltDiff = maxVoltDiff;
		maxVoltDiff = newMaxVoltDiff;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.SYNCHROCHECK_RELAY__MAX_VOLT_DIFF, oldMaxVoltDiff, maxVoltDiff));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_ANGLE_DIFF:
				if (resolve) return getMaxAngleDiff();
				return basicGetMaxAngleDiff();
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_FREQ_DIFF:
				if (resolve) return getMaxFreqDiff();
				return basicGetMaxFreqDiff();
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_VOLT_DIFF:
				if (resolve) return getMaxVoltDiff();
				return basicGetMaxVoltDiff();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_ANGLE_DIFF:
				setMaxAngleDiff((AngleRadians)newValue);
				return;
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_FREQ_DIFF:
				setMaxFreqDiff((Frequency)newValue);
				return;
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_VOLT_DIFF:
				setMaxVoltDiff((Voltage)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_ANGLE_DIFF:
				setMaxAngleDiff((AngleRadians)null);
				return;
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_FREQ_DIFF:
				setMaxFreqDiff((Frequency)null);
				return;
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_VOLT_DIFF:
				setMaxVoltDiff((Voltage)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_ANGLE_DIFF:
				return maxAngleDiff != null;
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_FREQ_DIFF:
				return maxFreqDiff != null;
			case ProtectionPackage.SYNCHROCHECK_RELAY__MAX_VOLT_DIFF:
				return maxVoltDiff != null;
		}
		return super.eIsSet(featureID);
	}

} //SynchrocheckRelayImpl
